package com.wanmait.deliverymangementsystem.service.impl;

import com.wanmait.deliverymangementsystem.mapper.UserAddressMapper;
import com.wanmait.deliverymangementsystem.pojo.UserAddress;
import com.wanmait.deliverymangementsystem.pojo.Users;
import com.wanmait.deliverymangementsystem.service.UserAddressService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserAdressServiceImpl implements UserAddressService {
@Resource
    private UserAddressMapper userAddressMapper;

    @Override
    public void addAddress(UserAddress userAddress) {
       userAddressMapper.insert(userAddress);
    }

    @Override
    public void delete(Integer userAddress) {
        userAddressMapper.deleteByID(userAddress);
    }

    @Override
    public List<UserAddress> showUserAddress(Users users) {
        return userAddressMapper.selectByUserID(users);
    }

    @Override
    public UserAddress findAddress(Integer id) {
        return userAddressMapper.findByID(id);
    }

    @Override
    public void updateMyAddress(UserAddress userAddress) {
       userAddressMapper.updateByID(userAddress);
    }

}
